package com.ruoyi.project.syl_zjw.newcheck.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.syl_zjw.newcheck.domain.MoneyOrder;
import com.ruoyi.project.syl_zjw.newcheck.domain.MoneyOrderQueryCondition;
import com.ruoyi.project.syl_zjw.newcheck.domain.OrderMoney;

import com.ruoyi.project.syl_zjw.newcheck.service.INewCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 检查管理：新开检查模块
 * @author:author
 * @date: 16:45 2021/7/14
 */
@RestController
@RequestMapping("/syl_zjw/newcheck")
public class NewCheckController extends BaseController {
    @Autowired
    private INewCheckService newCheckService;

    /**
     * 检查管理：新开检查查询检查项目
     * @return
     */
    @PreAuthorize("@ss.hasPermi('syl_zjw:newcheck:query1')")
    @GetMapping("query1")
    public AjaxResult findOrderMoneyList(){
        List<OrderMoney> orderMoneyList = newCheckService.findOrderMoneyList();
        System.out.println(orderMoneyList);
        return  AjaxResult.success(orderMoneyList);
    }

    /**
     * 通过检查项目名称或检查订单号查找患者信息
     * @return
     */
    @PreAuthorize("@ss.hasPermi('syl_zjw:newcheck:query2')")
    @GetMapping("query2")
    public AjaxResult findMoneyOrderOne(MoneyOrderQueryCondition queryCondotion){
        MoneyOrder moneyOrderOne = newCheckService.findMoneyOrderOne(queryCondotion);
        return AjaxResult.success(moneyOrderOne);
    }

    /**
     * 根据条件修改患者状态是否开始检查
     * @param moneyOrderQueryCondition
     * @return
     */
    @PreAuthorize("@ss.hasPermi('syl_zjw:newcheck:edit')")
    @GetMapping("edit")
    public AjaxResult changeStatus(MoneyOrderQueryCondition moneyOrderQueryCondition) {
        int rows = newCheckService.changeStatus(moneyOrderQueryCondition);
        return toAjax(rows);
    }
}
